package com.jefe.service.model.impl;

import com.jefe.service.model.ImageTbl;
import com.jefe.service.model.ImageTblSoap;

import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.HtmlUtil;
import com.liferay.portal.model.impl.BaseModelImpl;

import java.io.Serializable;

import java.lang.reflect.Proxy;

import java.sql.Types;

import java.util.ArrayList;
import java.util.List;


/**
 * <a href="ImageTblModelImpl.java.html"><b><i>View Source</i></b></a>
 *
 * <p>
 * ServiceBuilder generated this class. Modifications in this class will be
 * overwritten the next time is generated.
 * </p>
 *
 * <p>
 * This class is a model that represents the <code>ImageTbl</code> table
 * in the database.
 * </p>
 *
 * @author Brian Wing Shun Chan
 *
 * @see com.jefe.service.model.ImageTbl
 * @see com.jefe.service.model.ImageTblModel
 * @see com.jefe.service.model.impl.ImageTblImpl
 *
 */
public class ImageTblModelImpl extends BaseModelImpl<ImageTbl> {
    public static final String TABLE_NAME = "ImageTbl";
    public static final Object[][] TABLE_COLUMNS = {
            { "Image_id", new Integer(Types.INTEGER) },
            

            { "Image", new Integer(Types.VARCHAR) },
            

            { "Image_name", new Integer(Types.VARCHAR) }
        };
    public static final String TABLE_SQL_CREATE = "create table ImageTbl (Image_id INTEGER not null primary key,Image VARCHAR(75) null,Image_name VARCHAR(75) null)";
    public static final String TABLE_SQL_DROP = "drop table ImageTbl";
    public static final String DATA_SOURCE = "liferayDataSource";
    public static final String SESSION_FACTORY = "liferaySessionFactory";
    public static final String TX_MANAGER = "liferayTransactionManager";
    public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
                "value.object.entity.cache.enabled.com.jefe.service.model.ImageTbl"),
            true);
    public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
                "value.object.finder.cache.enabled.com.jefe.service.model.ImageTbl"),
            true);
    public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get(
                "lock.expiration.time.com.jefe.service.model.ImageTbl"));
    private int _Image_id;
    private String _Image;
    private String _Image_name;

    public ImageTblModelImpl() {
    }

    public static ImageTbl toModel(ImageTblSoap soapModel) {
        ImageTbl model = new ImageTblImpl();

        model.setImage_id(soapModel.getImage_id());
        model.setImage(soapModel.getImage());
        model.setImage_name(soapModel.getImage_name());

        return model;
    }

    public static List<ImageTbl> toModels(ImageTblSoap[] soapModels) {
        List<ImageTbl> models = new ArrayList<ImageTbl>(soapModels.length);

        for (ImageTblSoap soapModel : soapModels) {
            models.add(toModel(soapModel));
        }

        return models;
    }

    public int getPrimaryKey() {
        return _Image_id;
    }

    public void setPrimaryKey(int pk) {
        setImage_id(pk);
    }

    public Serializable getPrimaryKeyObj() {
        return new Integer(_Image_id);
    }

    public int getImage_id() {
        return _Image_id;
    }

    public void setImage_id(int Image_id) {
        _Image_id = Image_id;
    }

    public String getImage() {
        return GetterUtil.getString(_Image);
    }

    public void setImage(String Image) {
        _Image = Image;
    }

    public String getImage_name() {
        return GetterUtil.getString(_Image_name);
    }

    public void setImage_name(String Image_name) {
        _Image_name = Image_name;
    }

    public ImageTbl toEscapedModel() {
        if (isEscapedModel()) {
            return (ImageTbl) this;
        } else {
            ImageTbl model = new ImageTblImpl();

            model.setNew(isNew());
            model.setEscapedModel(true);

            model.setImage_id(getImage_id());
            model.setImage(HtmlUtil.escape(getImage()));
            model.setImage_name(HtmlUtil.escape(getImage_name()));

            model = (ImageTbl) Proxy.newProxyInstance(ImageTbl.class.getClassLoader(),
                    new Class[] { ImageTbl.class },
                    new ReadOnlyBeanHandler(model));

            return model;
        }
    }

    public Object clone() {
        ImageTblImpl clone = new ImageTblImpl();

        clone.setImage_id(getImage_id());
        clone.setImage(getImage());
        clone.setImage_name(getImage_name());

        return clone;
    }

    public int compareTo(ImageTbl imageTbl) {
        int pk = imageTbl.getPrimaryKey();

        if (getPrimaryKey() < pk) {
            return -1;
        } else if (getPrimaryKey() > pk) {
            return 1;
        } else {
            return 0;
        }
    }

    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }

        ImageTbl imageTbl = null;

        try {
            imageTbl = (ImageTbl) obj;
        } catch (ClassCastException cce) {
            return false;
        }

        int pk = imageTbl.getPrimaryKey();

        if (getPrimaryKey() == pk) {
            return true;
        } else {
            return false;
        }
    }

    public int hashCode() {
        return getPrimaryKey();
    }

    public String toString() {
        StringBuilder sb = new StringBuilder();

        sb.append("{Image_id=");
        sb.append(getImage_id());
        sb.append(", Image=");
        sb.append(getImage());
        sb.append(", Image_name=");
        sb.append(getImage_name());
        sb.append("}");

        return sb.toString();
    }

    public String toXmlString() {
        StringBuilder sb = new StringBuilder();

        sb.append("<model><model-name>");
        sb.append("com.jefe.service.model.ImageTbl");
        sb.append("</model-name>");

        sb.append(
            "<column><column-name>Image_id</column-name><column-value><![CDATA[");
        sb.append(getImage_id());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>Image</column-name><column-value><![CDATA[");
        sb.append(getImage());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>Image_name</column-name><column-value><![CDATA[");
        sb.append(getImage_name());
        sb.append("]]></column-value></column>");

        sb.append("</model>");

        return sb.toString();
    }
}
